package controller;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.IOException;

public class LoginOutServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public LoginOutServlet() {
        super();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        doPost(request, response);
    }
    public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException {
        HttpSession session = request.getSession(false);//防止创建Session
        session.invalidate();
//        Cookie cookie = new Cookie("userCode","");
//        response.addCookie(cookie);
        response.sendRedirect(request.getContextPath()+"/login.do");
    }
}
